package org.jeecg.enums.charge;

/**
 * 0待开票 1开票成功 2 开票中 3 开票失败
 */
public enum InvoiceStatusEnum {
    INVOICE_STATUS_NO("0", "待开票"),
    INVOICE_STATUS_SUCCESS("1", "开票成功"),
    INVOICE_STATUS_IN("2", "开票中"),
    INVOICE_STATUS_ERROR("3", "开票失败"),
    ;

    private String code;
    private String desc;

    InvoiceStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(String value) {
        if (value == null) return "";
        InvoiceStatusEnum[] enums = values();
        for (InvoiceStatusEnum typeEnum : enums) {
            if (value.equals(typeEnum.getCode())) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static String getValue(String desc) {
        InvoiceStatusEnum[] enums = values();
        for (InvoiceStatusEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
